<template>
  <div class="false-alarm-wrap">
    <div class="alarm-box">
      <span class="date">
        <i class="vul-icon-time"></i>
        <span>{{ item.updateTime }}</span>
      </span>
      <p class="line"></p>
      <span class="false-alarm-btn" @click="falseClick">
        <!-- <img src="@/static/images/retrieval/falseAlarm.png" alt="" /> -->
        <i class="vul-icon-prompt-line"></i>
        <span>标记为误报</span>
      </span>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { defineProps, defineEmits, ref } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { useStore } from 'vuex';
const store = useStore();
const props = defineProps({
  item: {
    type: Object,
    default: () => {
      return {};
    },
  },
});
const emit = defineEmits(['successFn']);
const dialogVisible = ref(false);

const falseClick = () => {
  ElMessageBox.confirm('确认此资产为误报吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
  })
    .then(async () => {
      const { code, data = {} } = await store.dispatch('attack/markAsset', {
        assetVulId: props.item.id,
      });
      if (code !== 0) {
        return;
      }
      ElMessage.success('标记误报成功！');
      emit('successFn');
    })
    .catch((error) => {
      console.error('Error in falseClick:', error);
    });
};
</script>
<style lang="scss" scoped>
.false-alarm-wrap {
  margin-left: 10px;
  .alarm-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 160px;
    .date {
      display: flex;
      align-items: center;

      i {
        // color: #8590b3;
        font-size: 14px;
        margin-right: 5px;
      }

      span {
        font-family: PingFangSC-Regular;
        font-size: 12px;
        line-height: 20px;
        // color: $-white;
      }
    }

    .line {
      height: 14.5px;
      border: 1px solid rgba(133, 144, 179, 0.3);
      margin: 0px 18px;
    }

    .false-alarm-btn {
      display: flex;
      align-items: center;
      cursor: pointer;
      width: 82px;
      img {
        width: 14px;
        height: 14px;
      }

      i {
        font-size: 12px;
        color: #ff3333;
        margin-right: 2px;
      }

      span {
        font-family: PingFangSC-Medium;
        font-size: 12px;
        line-height: 20px;
        color: #ff3333;
      }
    }
  }

  // .dialog-box {
  //   // color: rgb(255, 255, 255);
  // }

  // ::v-deep .el-dialog__header {
  //   i {
  //     color: rgb(158, 170, 184);
  //   }
  // }
}
</style>
